![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
webext-detect-page
Advanced tools
Detects where the current browser extension code is being run. Compatible with Firefox, Chrome and derivates.
Detects where the current browser extension code is being run. Chrome and Firefox.
You can download the standalone bundle and include it in your manifest.json
.
Or use npm
:
npm install webext-detect-page
// This module is only offered as a ES Module
import {
isBackgroundPage,
isContentScript,
isOptionsPage,
} from 'webext-detect-page';
import {isBackgroundPage} from 'webext-detect-page';
if (isBackgroundPage()) {
// Run background code, e.g.
browser.runtime.onMessage.addListener(console.log);
} else if (isContentScript()) {
// Run content script code, e.g.
browser.runtime.sendMessage('wow!');
}
The functions are only ever evaluated once. This protects from future "invalidated context" errors. Read the note about testing if you're running this code in a tester.
Returns a boolean
that indicates whether the code is being run on http(s)://
pages (it could be in a content script or regular web context).
Returns a boolean
that indicates whether the code is being run in extension contexts that have access to the chrome API.
Returns a boolean
that indicates whether the code is being run in a background page or background worker.
Returns a boolean
that indicates whether the code is being run in a background page (manifest v2).
Returns a boolean
that indicates whether the code is being run in a background worker (manifest v3).
Returns a boolean
that indicates whether the code is being run in a content script.
Returns a boolean
that indicates whether the code is being run in an options page. This only works if the current page’s URL matches the one specified in the extension's manifest.json
.
Returns a boolean
that indicates whether the code is being run in a dev tools page. This only works if the current page’s URL matches the one specified in the extension's manifest.json
devtools_page
field.
Returns a boolean
if it matches the current browser. They are loose detections based on the user agent that are useful when developing Web Extensions.
Returns the first matching context among those defined in index.ts
, depending on the current context:
The calls are automatically cached so, if you're using this in a test environment, import and call this function first to ensure that the environment is "detected" every time:
import {disableWebextDetectPageCache} from 'webext-detect-page';
disableWebextDetectPageCache();
content_scripts
on custom domains.Awesome WebExtensions
: A curated list of awesome resources for Web Extensions developmentMIT © Federico Brigante
FAQs
The package was renamed to `webext-detect`
The npm package webext-detect-page receives a total of 0 weekly downloads. As such, webext-detect-page popularity was classified as not popular.
We found that webext-detect-page demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.